<template>
	<view>
		<swiper :indicator-dots="false" :autoplay="false" :current="current" :duration="300" @change="changescroll" style="width: 100%;height: 100vh;">
			<swiper-item>
				<view class="swiper-item">
					<Index></Index>
				</view>
			</swiper-item>
			<swiper-item>
				<view class="swiper-item">
					<Me></Me>
				</view>
			</swiper-item>
		</swiper>
		<TabBar :current="current" @changetab="changetab"></TabBar>
	</view>
</template>

<script>
	import Index from "@/pages/index/index.vue"
	import Me from "@/pages/me/me.vue"
	import TabBar from "@/components/TabBar.vue"
	
	export default {
		components:{
			Index,
			Me,
			TabBar,
		},
		data() {
			return {
				current:0
			};
		},
		onLoad() {
			uni.setNavigationBarTitle({
			  title: '首页'
			})
		},
		methods:{
			changetab(e){
				this.current=e;
				console.log(e,'++++++++++++++++')
				
			},
			changescroll(e){
				this.current=e.detail.current;
				if(this.current==0){
					uni.setNavigationBarTitle({
					  title: '首页'
					})
				}else{
					uni.setNavigationBarTitle({
					  title: '我的'
					})
				}
			}
		}
	}
</script>

<style lang="scss">
.swiper-item{
	width: 100%;
	height: calc( 100% - 124rpx);
	overflow: scroll;
}
</style>
